<!-- 冲突查询
 -->
<template>
	<view>
		<view class="top-back">
			<view class="top-name">冲突查询</view>
		</view>
		<scroll-view scroll-y="true" class="uni-container">
			<view class="query-back">
				<view style="width: 320px;">
					<uni-forms ref="baseForm" :modelValue="baseFormData">
						<uni-forms-item label="客户名称：" labelWidth="100" labelAlign="right">
							<uni-easyinput v-model="baseFormData.custName" placeholder="请填写" />
						</uni-forms-item>
						<uni-forms-item label="标的名称：" labelWidth="100" labelAlign="right">
							<uni-easyinput v-model="baseFormData.targetName" placeholder="请填写" />
						</uni-forms-item>
						<uni-forms-item label="对方名称：" labelWidth="100" labelAlign="right">
							<uni-easyinput v-model="baseFormData.otherName" placeholder="请填写" />
						</uni-forms-item>
					</uni-forms>
				</view>
				<view class="bottom-btn" @click="requestData">查询</view>
			</view>
			<view class="result-back">
				<view class="result-name">查询结果：<text class="result-des">与{{totleCount}}条数据冲突</text></view>
				<uni-table border stripe ref="table" :loading="loading" stripe emptyText=" ">
					<uni-tr>
						<uni-th align="center">输入词</uni-th>
						<uni-th align="center">冲突词</uni-th>
						<uni-th align="center">冲突词类型</uni-th>
					</uni-tr>
					<uni-tr v-for="(item, index) in tableData" :key="index">
						<uni-td align="center"><text selectable="true">{{ item.importStr }}</text></uni-td>
						<uni-td align="center"><text selectable="true">{{ item.value }}</text></uni-td>
						<uni-td align="center"><text selectable="true">{{ item.type }}</text></uni-td>
					</uni-tr>
				</uni-table>
				<view class="search-back" v-if="tableData.length == 0">
					<image class="search-image" :src="pc_search_nodata"></image>
					<view class="search-noresult">没有查询到结果</view>
				</view>
			</view>
		</scroll-view>
	</view>
</template>

<script>
	import statusTag from "@/packageC/PhonePC/components/tags/tags.vue"
	let app = ''
	
	export default {
		components: {
			statusTag
		},
		data() {
			return {
role: '', //当前登录角色
				roleUrl: '',
				tableData: [],
				baseFormData: {
					custName: '',
					targetName: '',
					otherName: ''
				},
				totleCount: 0,
				pc_search_nodata:getApp().globalData.baseImageUrl+'/pc_search_nodata.png'
			}
		},
		
		mounted() {
		var _this = this;
		app = getApp()
		_this.role = app.globalData.role
		_this.roleUrl = _this.$roleUrl({
			tab: _this.role
		})	
		},

		methods: {
			//网络请求示例
			async requestData() {
				let _this = this

				let parmas = {
					'custName': _this.baseFormData.custName,
					"targetName": _this.baseFormData.targetName,
					"otherName": _this.baseFormData.otherName
				}
				
				const res = await this.$myRequest({
					url: `/${_this.roleUrl}/clash/check`,
					method: 'GET',
					data: parmas,
				})
				console.log('返回结果', res)
				if (res.data.code == 200) {
					_this.totleCount = res.data.data.length
					_this.tableData = res.data.data
				}
			},
		}
	}
</script>

<style scoped>
	.top-back {
		display: flex;
		align-items: center;
		padding: 10px;
	}

	.top-name {
		color: #333;
		font-size: 18px;
		font-weight: bold;
		margin-left: 30px;
	}



	.uni-container {
		margin-left: 40px;
		margin-right: 16px;
		width: auto;
	}

	.search-back {
		width: 100%;
		height: 100%;
		display: flex;
		justify-content: center;
		align-items: center;
		flex-direction: column;
	}

	.search-noresult {
		font-size: 14px;
		color: #333;
		font-weight: 400;
	}

	.search-image {
		width: 150px;
		height: 150px;
	}

	.query-back {
		margin-top: 15px;
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
	}

	.bottom-btn {
		cursor: pointer;
		width: 104px;
		height: 32px;
		background: #2DA9C5;
		border-radius: 2px;
		color: #FFFFFF;
		font-size: 14px;
		display: flex;
		justify-content: center;
		align-items: center;
	}

	.result-back {
		margin-top: 30px;
	}

	.result-name {
		font-size: 14px;
		font-weight: 600;
		color: #333333;
		display: flex;
	}

	.result-des {
		font-size: 14px;
		font-weight: 400;
		color: #FF6132;
	}
</style>
